package com.lecing.data.entity;

/**
 * 代理IP配置bean
 * Created by liucs on 2018/5/11.
 */
public class ProxyConfigBean {
    private String ip;
    private int port;
    private String country;//中国，其他国家
    private String type;//匿名 程度high、anonymous、elite、transparent
    private String statu;//空闲、繁忙、较忙
    private int priority;//优先级

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getStatu() {
        return statu;
    }

    public void setStatu(String statu) {
        this.statu = statu;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority() {

        //根据国家设置优先级
        if (this.country.contains("中国")) {
            this.priority += 50;
        }

        //根据状态设置优先级,空闲(10)、繁忙(0)、较忙(5)
        if (this.statu.contains("空闲")) {
            this.priority += 20;
        } else if (this.statu.contains("较忙")) {
            this.priority += 10;
        }

//根据类型设置优先级匿名 程度high(4)、anonymous(5)、elite(2)、transparent(3)
        if (this.type.contains("anonymous")) {
            this.priority += 5;
        } else if (this.type.contains("high")) {
            this.priority += 4;
        } else if (this.type.contains("transparent")) {
            this.priority += 3;
        } else if (this.type.contains("elite")) {
            this.priority += 2;
        }
        //根据端口,80端口最优
        if (this.port == 80) {
            this.priority += 1;
        }
    }
}
